Skip to content

feat: support stream - #4

Merged
InftyAI-Agent merged 9 commits into
InftyAI:mainfrom
kerthcet:feat/support-ops
Jul 20, 2026
Merged

InftyAI-Agent merged 9 commits into
InftyAI:mainfrom
kerthcet:feat/support-ops

Conversation

@kerthcet

Copy link
Copy Markdown
Member

What this PR does / why we need it

Which issue(s) this PR fixes

Fixes #

Special notes for your reviewer

Does this PR introduce a user-facing change?


Signed-off-by: kerthcet <kerthcet@gmail.com>
Copilot AI review requested due to automatic review settings July 20, 2026 15:59
@InftyAI-Agent InftyAI-Agent added needs-triage Indicates an issue or PR lacks a label and requires one. needs-priority Indicates a PR lacks a label and requires one. do-not-merge/needs-kind Indicates a PR lacks a label and requires one. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 20, 2026
@kerthcet

Copy link
Copy Markdown
Member Author

/kind feature

@InftyAI-Agent InftyAI-Agent added feature Categorizes issue or PR as related to a new feature. and removed do-not-merge/needs-kind Indicates a PR lacks a label and requires one. labels Jul 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a first-class Stream abstraction to the safe mlx crate API and wires stream selection into common array operations, enabling explicit CPU/GPU scheduling while keeping operator ergonomics via the default stream.

Changes:

  • Add a safe Stream wrapper with CPU/GPU constructors, Default, and set_as_default.
  • Extend Array with eval + scalar/vec extraction helpers and add stream-aware arithmetic/unary/reduction ops.
  • Add operator overloads that run on the current default stream; update the hello example accordingly.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/mlx/src/stream.rs Introduces Stream wrapper + default-stream management API.
crates/mlx/src/lib.rs Exposes Stream from the crate root.
crates/mlx/src/dtype.rs Extends ArrayElement to support typed scalar reads and typed data pointers.
crates/mlx/src/array.rs Adds stream-aware ops, evaluation helpers, and operator overloads using the default stream.
crates/mlx/examples/hello.rs Demonstrates default-stream behavior and per-op explicit stream control.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/mlx/src/array.rs Outdated
Comment thread crates/mlx/src/array.rs Outdated
Comment thread crates/mlx/src/array.rs
Signed-off-by: kerthcet <kerthcet@gmail.com>
Copilot AI review requested due to automatic review settings July 20, 2026 16:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Comment thread crates/mlx/src/error.rs
Comment thread crates/mlx/src/stream.rs
Comment thread crates/mlx/src/stream.rs
Comment thread crates/mlx/src/stream.rs
Comment thread crates/mlx/src/stream.rs
Comment thread crates/mlx/src/array.rs
Comment thread crates/mlx/src/array.rs
Signed-off-by: kerthcet <kerthcet@gmail.com>
Copilot AI review requested due to automatic review settings July 20, 2026 20:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread crates/mlx/src/error.rs
Signed-off-by: kerthcet <kerthcet@gmail.com>
Copilot AI review requested due to automatic review settings July 20, 2026 20:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread crates/mlxr/src/array.rs
Comment thread crates/mlxr/src/array.rs
kerthcet added 2 commits July 20, 2026 23:33
Signed-off-by: kerthcet <kerthcet@gmail.com>
Signed-off-by: kerthcet <kerthcet@gmail.com>
Copilot AI review requested due to automatic review settings July 20, 2026 22:36
Signed-off-by: kerthcet <kerthcet@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 20, 2026 22:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.

Comment thread crates/mlxcore/src/array.rs
Signed-off-by: kerthcet <kerthcet@gmail.com>
Copilot AI review requested due to automatic review settings July 20, 2026 23:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (2)

crates/mlxcore-sys/build.rs:17

  • The panic message says "macOS on Apple Silicon", but the guard only checks target_os = "macos". Building on macOS x86_64 will proceed until later failures. Prefer checking target_arch = "aarch64" too so the early error matches the supported platform.
    README.md:39
  • cargo run --example hello won't work from a virtual workspace root (this repo's root Cargo.toml has no [package]). You need to specify the package that owns the example, otherwise Cargo errors due to missing default package selection.
Runnable examples live in `crates/mlxcore/examples`:

```sh
cargo run --example hello
</details>


Comment thread crates/mlxcore/examples/hello.rs
Comment thread Cargo.toml
Signed-off-by: kerthcet <kerthcet@gmail.com>
Copilot AI review requested due to automatic review settings July 20, 2026 23:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

crates/mlxcore-sys/build.rs:17

  • The platform guard only checks target_os = "macos", but the panic message claims Apple Silicon only. Either enforce target_arch = "aarch64" as well, or adjust the message so it matches what the code actually checks.
    crates/mlxcore/src/lib.rs:2
  • This intra-doc link likely won’t resolve because Cargo crate names use hyphens (mlxcore-sys), but Rust paths/intra-doc links use underscores (mlxcore_sys). Use the Rust crate identifier in the link target.

@kerthcet

Copy link
Copy Markdown
Member Author

/lgtm

@InftyAI-Agent InftyAI-Agent added the lgtm Looks good to me, indicates that a PR is ready to be merged. label Jul 20, 2026

@InftyAI-Agent InftyAI-Agent left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved: PR has both lgtm and approved labels

@InftyAI-Agent
InftyAI-Agent merged commit 4351624 into InftyAI:main Jul 20, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. feature Categorizes issue or PR as related to a new feature. lgtm Looks good to me, indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a label and requires one. needs-triage Indicates an issue or PR lacks a label and requires one.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants